Documentation For Marginal Damages Model
This directory contains: Marginal damages model code, inputs, outputs, and preprocessing of data that was later used as model inputs. Each individual file has its own metadata with a brief description, including brief dataset descriptions for data files.

The code 'Marginal_Damages_Model/Code/Marginal_Damages_Model.R' code calculates the marginal damages per metric ton of emissions. A previous version of this code has been published by Choma (2021) [file: Marginal_Damages_Model_Script.R] (https://dataverse.harvard.edu/file.xhtml?fileId=5374938&version=1.0), which we adapt to calculate asthma damages.

This R code was executed in R version 3.5.1 (R Core Team, 2018) loading packages 'ncdf4' and 'mgcv' (Wood, 2011; 2016), which also requires 'nlme' (Pinheiro et al., 2000; 2018).

1. Data inputs required to run the code:
(1.1) All data inputs required in the previous code by Choma (2021) -- see documentation file Choma (2021) [file: Documentation_Marginal_Damages_Model_ReadMe.txt] (https://dataverse.harvard.edu/file.xhtml?fileId=5446896&version=1.0). These files include some that are provided by Choma (2021), and files that need to be downloaded, for which downloading instructions can be found in Choma (2021).

(1.2) New Inputs required to estimate asthma cases. These are provided with the deposit in the file 'Marginal_Damages_Model/Inputs/Model_Inputs_Asthma.RData'.
This file is generated by the code in the subdirectory 'Preprocessing_of_Data', namely, by the code 'Marginal_Damages_Model/Preprocessing_of_Data/Code/Process_Asthma_Data.R'. 
Duplicate copies of the 'Model_Inputs_Asthma.RData' file are provided with /Inputs of the Marginal Damages Model code and /Outputs of the preprocessing of data. 


2. Model outputs produced:
We generate two sets of results. A summary of the outputs is below, but the documentation file in Choma (2021) [file: Documentation_Marginal_Damages_Model_ReadMe.txt] (https://dataverse.harvard.edu/file.xhtml?fileId=5446896&version=1.0) provides more details, although that version does not calculate childhood asthma risks.

(2.1) Marginal damages per metric ton of ground-level emissions (which we label Marginal Values -- MV), for each county. 
(2.2) The source-receptor matrix (which we label SRM or SR) for the marginal damages -- these are matrices MI described in Eq. S2 of the supplementary information of our current article. The SRMs contain the marginal damages occurring in each county as a consequence of a ground-level emission of 1 metric ton in each county. The rows are the sources and the columns are the receptors, so that the row sums for these matrix are equivalent to the total marginal damages (i).

For both (2.1) and (2.2), the marginal damages model calculates damages for a combination of 100 different pollutant species, CRFs, Baseline ambient PM2.5 levels, and Asthma and Mortality data. These are:

For Mortality (80 combinations)
* 5 pollutant species: (Primary PM2.5, SO2, NOX, NH3, and VOC
* 4 CRFs: GEMM (Burnett et al., 2018), Vodonos et al. (2018) Parametric, Vodonos et al. (2018) Spline, and Krewski et al. (2009).
* 2 Baseline ambient PM2.5 levels: 2008 and 2017
* 2 Baseline Mortality Data: 2008 and 2017

For Asthma (20 combinations)
* 5 pollutant species: (Primary PM2.5, SO2, NOX, NH3, and VOC
* 4 age groups (children aged 0-4 years, 5-11 years, 12-17 years, and the sum for all 0-17 years)

ALL values are monetized damages (2017 USD for Mortality, 2022 for Asthma) caused by emissions of 1 metric ton (10^6 grams) of a given pollutant, in each source.

The counties (rows in the MV files; both rows and columns in the SRM files) are presented in the same order of the counties listed in the auxiliary output file
'Marginal_Damages_Model/Outputs/Auxiliary/STCOUList.csv'

Source of this documentation: Choma (2021) [file: Documentation_Marginal_Damages_Model_ReadMe.txt] (https://dataverse.harvard.edu/file.xhtml?fileId=5446896&version=1.0)

Note: We only provide the model outputs used in the current manuscript. These include the asthma outputs and the mortality outputs calculated using 2017 baseline ambient PM2.5 levels, 2017 baseline mortality data (of which we only use those and calculated with the GEMM (Burnett et al., 2018) CRF). We do not provide all the outputs that are generated by the code, and that were used in our previous paper (Choma et al., 2021). 
We provide:
A) The model outputs for Asthma, which had not previously calculated by Choma et al (2021). Files
'Marginal_Damages_Model/Outputs/MV_Damages_BasePM_2017_Asthma_2019.RData'
'Marginal_Damages_Model/Outputs/SRM_BasePM_2017_Asthma_2019.RData'

B) The model outputs for mortality using 2017 data for baseline ambient PM2.5 levels and baseline mortality data. 
'Marginal_Damages_Model/Outputs/MV_Damages_BasePM_2017_Mortality_2017.RData'
'Marginal_Damages_Model/Outputs/SRM_BasePM_2017_Mortality_2017.RData'
We note that these two files in B include marginal damages calculated with the four different CRFs; however, in our manuscript we only use results calculated using the GEMM (Burnett et al., 2018) CRF.

Each output file in A and B contain its own metadata with detailed descriptions of elements, but briefly:
* SRMs are provided as 3,108 x 3,108 x k arrays, where element i,j,k represents the marginal damage (in 2017 USD for mortality, in 2022 for asthma files) per metric ton of emissions occurring in county j as a consequence of 1 tonne of ground-level emissions in county i. Dimension 3 ('slice'), denoted by the index k, represents what pollutant these emissions refer to and, in the case of childhood asthma, among which age group these health impacts/marginal damages occur. In these arrays, Dimension 1 ('row') are the sources (3,108 counties) -- in the same order of the 'Marginal_Damages_Model/Outputs/Auxiliary/STCOUList.csv' file Dimension 2 ('column') are the receptors (3,108 counties) -- in the same order of the 'Marginal_Damages_Model/Outputs/Auxiliary/STCOUList.csv' file. Dimension 3 ('slice') are the pollutants.

* MVs are provided 3,108 x j matrices, where element i,j represents the marginal damage (in 2017 USD for mortality, in 2022 for asthma files) as a consequence of one metric ton of emissions in county i. Dimension 2 ('column'), denoted by the index j, represents what pollutant these emissions refer to and, in the case of childhood asthma, among which age group these health impacts/marginal damages occur -- following index 'k' for the SRMs. Index i (Dimension 1 or 'row') are the sources (3,108 counties) -- in the same order of the 'Marginal_Damages_Model/Outputs/Auxiliary/STCOUList.csv' file. 

Indexes 'k' (for SRMs) and 'j' (for MVs):
For mortality files, 'k' (for SRMs) and 'j' (for MVs) = 5, representing, in order, the pollutants 1: Primary PM2.5 2: SO2 3: NOX 4: NH3 5: VOC 
For childhood asthma files, 'k' (for SRMs) and 'j' (for MVs) = 20, where.
k = 1,2,3,4,5 represents impacts occurring among children 0 to 4 years old, for the pollutants 1: Primary PM2.5 2: SO2 3: NOX 4: NH3 5: VOC 
k = 6,7,8,9,10 represents impacts occurring among children 5 to 11 years old, for the pollutants 6: Primary PM2.5 7: SO2 8: NOX 9: NH3 10: VOC 
k = 11,12,13,14,15 represents impacts occurring among children 12 to 17 years old, for the pollutants 11: Primary PM2.5 12: SO2 13: NOX 14: NH3 15: VOC 
k = 16,17,18,19,20 represents impacts occurring among children 0 to 17 years old, for the pollutants 16: Primary PM2.5 17: SO2 18: NOX 19: NH3 20: VOC 

These marginal damages model outputs are used as inputs for the 'Results_With_Emissions/Results_With_Emissions.R' code and a duplicate copy of these marginal damages model outputs are provided in the subdirectory 'Results_With_Emissions/Inputs'.

References:
Burnett, R., Chen, H., Szyszkowicz, M., Fann, N., Hubbell, B., Pope, C.A., …, Spadaro, J.V., 2018. Global estimates of mortality associated with long-term exposure to outdoor fine particulate matter. Proc. of the Natl. Acad. of Sci. of the U. S. A. 115, 9592-9597. https://doi.org/10.1073/pnas.1803222115.

E. Choma (2021). Replication Data for: Choma, E. F., Evans, J. S., Gómez-Ibáñez, J. A., Di, Q., Schwartz, J., Hammitt, J. K., Spengler, J. D. (2021). "Health benefits of decreases in on-road transportation emissions in the United States from 2008 to 2017". Accepted for publication at Proceedings of the National Academy of Sciences of the United States of America Version V1) Harvard Dataverse. https://doi.org/doi:10.7910/DVN/V3SXIM
Link to individual files:
Code [Marginal_Damages_Model_Script.R]: https://dataverse.harvard.edu/file.xhtml?fileId=5374938&version=1.0
Documentation [Documentation_Marginal_Damages_Model_ReadMe.txt] (https://dataverse.harvard.edu/file.xhtml?fileId=5446896&version=1.0)

E. F. Choma et al., Health benefits of decreases in on-road transportation emissions in the United States from 2008 to 2017. Proceedings of the National Academy of Sciences 118, e2107402118 (2021).
Choma, E. (2021). Replication Data for: Choma, E. F., Evans, J. S., Gómez-Ibáñez, J. A., Di, Q., Schwartz, J., Hammitt, J. K., Spengler, J. D. (2021). "Health benefits of decreases in on-road transportation emissions in the United States from 2008 to 2017". Accepted for publication at Proceedings of the National Academy of Sciences of the United States of America Version V1) Harvard Dataverse. https://doi.org/doi:10.7910/DVN/V3SXIM

D. Pierce, R package “ncdf4”: Interface to Unidata netCDF (Version 4 or Earlier) Format Data Files (Package version: 1.16, 2017). https://CRAN.R-project.org/package=ncdf4

José C. Pinheiro, Douglas M. Bates, Mixed-Effects Models in S and S-PLUS. (2000). In Statistics and Computing. Springer-Verlag. https://doi.org/10.1007/b98882

J. Pinheiro, D. Bates, R Core Team, R package “nlme”: Linear and Nonlinear Mixed Effects Models (Package version: 3.1-137, 2018). https://CRAN.R-project.org/package=nlme

Krewski, D., Jerrett, M., Burnett, R.T., Ma, R., Hughes, E., Shi, Y., …, Thun, M.J., 2009. Extended Follow-Up and Spatial Analysis of the American Cancer Society Study Linking Particulate Air Pollution and Mortality. Health Effects Institute, Boston MA: HEI Research Report 140. https://www.healtheffects.org/system/files/Krewski140.pdf (accessed 22 April 2020).

R Core Team, R: A Language and Environment for Statistical Computing (R version 3.5.1, 2018). R Foundation for Statistical Computing, Vienna, Austria. https://www.R-project.org/

Vodonos, A, Abu Awad, Y., Schwartz, J., 2018. The concentration-response between long-term PM2.5 exposure and mortality; A meta-regression approach. Environ. Res. 166, 677-689. https://doi.org/10.1016/j.envres.2018.06.021.

S. N. Wood, Fast stable restricted maximum likelihood and marginal likelihood estimation of semiparametric generalized linear models. Journal of the Royal Statistical Society: Series B (Statistical Methodology) 73, 3-36 (2011). https://doi.org/10.1111/j.1467-9868.2010.00749.x

S. Wood, R package “mgcv”: Mixed GAM Computation Vehicle with Automatic Smoothness Estimation (Package version: 1.8-24, 2016). https://CRAN.R-project.org/package=nlme